

function updatePasswordForm(userid){

     document.getElementById('light').style.display='block';
     document.getElementById('fade').style.display='block';
     document.getElementById("formTitle").innerText = "修改密码";
     document.getElementById("updateId").value=userid;
     document.getElementById("sortPassword").setAttribute("style", " display: block;")
 }

 function addUserForm(){
     document.getElementById('light').style.display='block';
     document.getElementById('fade').style.display='block';
     document.getElementById("formTitle").innerText = "添加账号";
     document.getElementById("sortMessage").setAttribute("style", " display: block;")
 }

function deleteUser(id) {
    var r = confirm("确认删除该用户吗")
    if (r == true) {
        document.getElementById("deleteFormInput").value = id;
        document.getElementById("deleteForm").submit();
    }
}

function search() {
    document.getElementById("searchInputForm").submit();
}

 function closeForm() {
     document.getElementById("warrningContent").innerText="";
     document.getElementById('light').style.display='none';
     document.getElementById('fade').style.display='none';
     document.getElementById("sortPassword").setAttribute("style", " display: none;")
     document.getElementById("sortMessage").setAttribute("style", " display: none;")
 }

function reload(){
    window.location.href="http://localhost:8081/als/accountManagement";
}

function tipToView(add,del,update) {

    if(add!=null && add!=''){
        if(add=='true'){
            alert("添加成功！")
        }else {
            alert("添加失败！")
        }
    }
    if(del!=null&& del!=''){
        if(del=='true'){
            alert("删除成功！")
        }else {
            alert("删除失败！")
        }
    }
    if(update!=null&& update!=''){
        if(update=='true'){
            alert("修改成功!")
        }else {
            alert("修改失败！")
        }
    }
}

function addUserSubmit() {
    document.getElementById("warrningContent").innerText="";
    document.getElementById("addUser").submit();
}

function updatePasswordSubmit() {
    document.getElementById("warrningContent").innerText="";
    document.getElementById("sortPasswordForm").submit();
}


function checknull(obj,message) {
    if(obj.value==""){
        document.getElementById("warrningContent").innerText=message;
    }
}




function checkEmail(strEmail) {
    var emailReg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
    if ( emailReg.test(strEmail) ) {
        return true;
    }
    else {
        return false;
    }
}
function emailCheck() {
    var emailValue = document.getElementById("newemail").value;
    var email_hint = document.getElementById("warrningContent");
    var flag = checkEmail(emailValue);
    if(flag) {
        email_hint.innerHTML = "邮箱格式正确";
        return true;
    } else {
        email_hint.innerHTML = "邮箱格式错误";
        return false;
    }
}


function checkMobile( strMobile ) {
    var regu = /^[1][345678][0-9]{9}$/;
    var re = new RegExp(regu);
    if (re.test(strMobile)) {
        return true;
    }
    else {
        return false;
    }
}
function phoneCheck() {
    var phone = document.getElementById("newphone").value;
    var phone_hint = document.getElementById("warrningContent");
    var flag = checkMobile(phone);
    if (flag) {
        phone_hint.innerHTML = "手机号格式正确";
        return true;
    } else {
        phone_hint.innerHTML = "手机号格式错误";
        return false;
    }
}






